<?php
include_once '../common_mbs.inc.php';
include_once '../smarty.inc.php';

//判断访问权限
$admin_index_module_obj = new osgh_admin_index_module_cls();
$is_warrant = $admin_index_module_obj->is_have_warrant($_ADMIN_ID,'news_type_list');
if(!$is_warrant) tcmc_cls::ShowMsg("没有权限访问！", "../index_body.html");

$news_type_obj = new news_type_cls();
$act = trim($_INPUT['action']);
$news_type_id  = $_INPUT['news_type_id'];
if($act =='save')
{   
	if(empty($news_type_id)){
		$data = array(
			'news_type_name' => $_INPUT['news_type_name'],
			'od' => $_INPUT['od'],
		);
		$news_type_obj->add_news_type($data);
		tcmc_cls::ShowMsg("添加新闻分类成功！", "news_type_list.php");
	}else{
		  $up_data = array(
						'news_type_id' => $news_type_id,
						'news_type_name' => $_INPUT['news_type_name'],		
						'od' => $_INPUT['od'],
					 );
		   $news_type_obj->update_news_type($up_data, $news_type_id);
		   tcmc_cls::ShowMsg("修改新闻分类成功！", "news_type_list.php");
	}
}elseif($act =='del'){
	$news_type_obj->del_news_type($news_type_id);
	tcmc_cls::ShowMsg("删除新闻分类成功！", "news_type_list.php");
}

?>
